//
//  SNCompilePlanCell.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/12/26.
//  Copyright © 2016年 stone. All rights reserved.
//
#import "SNSummaryInfoViewController.h"
#import "UIImageView+TapGesture.h"
#import "SNCompilePlanSeedCell.h"
#import "SNPlanListLabel.h"
#import "SNSeedViewController.h"
#import "SNPlanListViewController.h"

@interface SNCompilePlanSeedCell()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *iconImageViewHeightLayoutConstraint;
@property (strong, nonatomic) IBOutletCollection(UILabel) NSArray *leftLabels;
@property (weak, nonatomic) IBOutlet UILabel *plantTypes;
@property (weak, nonatomic) IBOutlet UILabel *seedTotal;
@property (weak, nonatomic) IBOutlet UILabel *seedManu;
@property (weak, nonatomic) IBOutlet UILabel *seedPerUse;
@property (weak, nonatomic) IBOutlet UILabel *seedPrice;

@end
@implementation SNCompilePlanSeedCell
-(void)setProductionPlanListResult:(SNProductionPlanListResult *)productionPlanListResult{
    _productionPlanListResult = productionPlanListResult;
    self.plantTypes.text = [NSString stringWithFormat:@"* 种植品种 : %@",productionPlanListResult.seedBrand];
    self.seedTotal.text = [NSString stringWithFormat:@"* 种植总量 : %@吨",productionPlanListResult.seedTotal];
    self.seedManu.text = [NSString stringWithFormat:@"   厂家 : %@",productionPlanListResult.seedManu];
//    self.seedPerUse.text = [NSString stringWithFormat:@"* 单位用量 : %@/公顷",productionPlanListResult.seedPerUse];
    self.seedPrice.text = [NSString stringWithFormat:@"* 价格 : %@元/市斤",productionPlanListResult.seedPrice];

    [self.leftLabels enumerateObjectsUsingBlock:^(UILabel *  obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [SNUtils specialLabelWithstring:obj.text keyString:@"*" label:obj color:HexRGB(0xFF5D04)];
    }];
}
- (void)setModel:(SNPlanListModel *)model{
    _model = model;
    self.plantTypes.text = [NSString stringWithFormat:@"* 种植品种 : %@",model.plantTypes];
    self.seedTotal.text = [NSString stringWithFormat:@"* 种植总量 : %@吨",model.seedTotal];
    self.seedManu.text = [NSString stringWithFormat:@"* 厂家 : %@",model.seedManu];
    self.seedPerUse.text = [NSString stringWithFormat:@"* 单位用量 : %@/公顷",model.seedPerUse];
    self.seedPrice.text = [NSString stringWithFormat:@"* 价格 : %@元/市斤",model.seedPrice];

    [self awakeFromNib];
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        CALayer * layer = [CALayer layer];
        
        layer.frame = CGRectMake(50, 0, [UIScreen mainScreen].bounds.size.width - 50 - 15 - 12, 1);
        /** color */
        layer.backgroundColor = HexRGB(0xE2E2E2).CGColor;
        
        [self.contentView.layer addSublayer:layer];
    }
    return self;
}
- (void)configCellWithTitle:(NSString *)title imageName:(NSString *)imageName{
    self.iconImageView.image = [UIImage imageNamed:imageName];
//    self.leftLabel.text = [NSString stringWithFormat:@"* %@",title];
//    
//    [SNUtils specialLabelWithstring:self.leftLabel.text keyString:@"*" label:self.leftLabel color:HexRGB(0xFF5D04)];
    
    
    UIImage * image = self.iconImageView.image;
    
    self.iconImageViewHeightLayoutConstraint.constant = 20 * image.size.height / image.size.width;
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self.leftLabels enumerateObjectsUsingBlock:^(UILabel *  obj, NSUInteger idx, BOOL * _Nonnull stop) {
        [SNUtils specialLabelWithstring:obj.text keyString:@"*" label:obj color:HexRGB(0xFF5D04)];
    }];
    
    
    
    UIImage * image = self.iconImageView.image;
    
    self.iconImageViewHeightLayoutConstraint.constant = 20 * image.size.height / image.size.width;
}

@end
